package com.mc.lp.database.entity.type;


public enum EntityType{

	// Warning never changed the id for any entity type, it may mess the DB.
	// Best Practice please add the new one at last
	DEFAULT(0),
	PARENT(1),
	STUDENT(2),
	APPLICATION_USER(3);
	
	private int id;

	private EntityType(int id) {
		this.id = id;
	}
	
	public static EntityType getType(Integer id) {
	       
        if (id == null) {
            return null;
        }
 
        for (EntityType entityType : EntityType.values()) {
            if (id.equals(entityType.getId())) {
                return entityType;
            }
        }
        throw new IllegalArgumentException("No matching type for id " + id);
    }
 
    public int getId() {
        return id;
    }
}
